/*
 * MemoryMapManager.java
 *
 * Created on 11 de enero de 2008, 07:49 AM
 */

package org.model.modbus;

import org.model.data.Device;

/**
 *
 * @author German Garcia
 */
public class MemoryMapManager {

    public static String read(Device device, String datetime, GSMModbusSerialTransaction modbusSerialTransaction) {
        String dataFrame = null;

        if(device.getType()==0/*if instanceof Gles*/) {
            if(device.getReference().equals(Device.GLES_V1)) {
                dataFrame = device.readConfiguration(datetime, modbusSerialTransaction);
            } else if(device.getReference().equals(Device.GLES_V2)) {
            }
        } else {
            if(device.getReference().equals(Device.RISH)) {
                dataFrame = device.readRISHParameters(datetime, modbusSerialTransaction);
            } else if(device.getReference().equals(Device.GSM)) {
                dataFrame = device.readGSMParameters(datetime, modbusSerialTransaction);
            }
        }

        return dataFrame;
    }

    public static boolean write(Device gles, String data, GSMModbusSerialTransaction modbusSerialTransaction) {
        if(gles.getReference().equals(Device.GLES_V1)) {
            return gles.writeConfiguration(data, modbusSerialTransaction);
        } else if(gles.getReference().equals(Device.GLES_V2)) {
        }
        return false;
    }

    private MemoryMapManager() {
    }
}
